from zope.interface import implements, Interface

from Products.Five import BrowserView
from Products.CMFCore.utils import getToolByName
from zope.component import queryUtility
from zope.i18n.interfaces import ITranslationDomain

from my315ok.goodfccontent import goodfccontentMessageFactory as _


class IfcinfoView(Interface):
    """
    fcinfo view interface
    """

    def model():
        """ return house model"""


class fcinfoView(BrowserView):
    """
    fcinfo browser view
    """
    implements(IfcinfoView)

    def __init__(self, context, request):
        self.context = context
        self.request = request

    @property
    def portal_catalog(self):
        return getToolByName(self.context, 'portal_catalog')

    @property
    def portal(self):
        return getToolByName(self.context, 'portal_url').getPortalObject()

    def getGender(self):
        """
        return house model
        
        """

        gender = self.context.getGender()
        util = queryUtility(ITranslationDomain, 'my315ok.xtinfocontent')
        gender = util.translate(gender,
                                       target_language="zh",
                                       default="male")
        return gender
    def model(self):
        
        model = str(self.context.getRooms()) + rooms + str(self.context.getTings()) + tings \
        + str(self.context.getWeis()) + weis

        return model
    
    def floors(self):
        """return floor details"""
        foors = str(self.context.getFloor()) + u"/" + str(self.context.getFloors())
        return floors
    def size(self):
        size = str(self.context.getSize())
        return size
